﻿// -----------------------------------------------------------------------
//  <copyright file="ResetSettingCommand.cs" company="LiuliuSoft">
//      Copyright (c) 2025 66SOFT. All rights reserved.
//  </copyright>
//  <site>https://ifs.66soft.net</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2025-10-09 11:10</last-date>
// -----------------------------------------------------------------------

using DaprPlus.Domain;
using DaprPlus.Settings.Domain.Dtos;
using DaprPlus.Settings.Domain.Services;


namespace DaprPlus.Settings.Application.Commands;

public class ResetSettingCommand(string typeName) : IRequest<ApiResult<SettingDefinitionOutDto>>
{
    public string TypeName { get; } = typeName;
}

public class ResetSettingCommandHandler(ISettingStore store) : IRequestHandler<ResetSettingCommand, ApiResult<SettingDefinitionOutDto>>
{
    public async Task<ApiResult<SettingDefinitionOutDto>> Handle(ResetSettingCommand request, CancellationToken cancellationToken)
    {
        var result = await store.ResetSettingAsync(request.TypeName, cancellationToken);
        return result;
    }
}